home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / JFC.bin / MultiFileChooserUI.java < prev    next >
Text File  |  1998-06-30  |  5KB  |  150 lines

  1. /*
  2.  * @(#)MultiFileChooserUI.java    1.11 98/04/14
  3.  * 
  4.  * Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  */
  20.  
  21. package com.sun.java.swing.plaf.multi;
  22.  
  23. import java.util.Vector;
  24. import java.io.Serializable;
  25. import com.sun.java.swing.*;
  26. import java.awt.*;
  27. import java.io.File;
  28. import com.sun.java.swing.plaf.*;
  29. import com.sun.java.swing.preview.*;
  30. import com.sun.java.swing.preview.filechooser.*;
  31.  
  32. /**
  33.  * MultiFileChooserUI implementation
  34.  * <p>
  35.  * Warning: serialized objects of this class will not be compatible with
  36.  * future swing releases.  The current serialization support is appropriate
  37.  * for short term storage or RMI between Swing1.0 applications.  It will
  38.  * not be possible to load serialized Swing1.0 objects with future releases
  39.  * of Swing.  The JDK1.2 release of Swing will be the compatibility
  40.  * baseline for the serialized form of Swing objects.
  41.  *
  42.  * @version 1.11 04/14/98
  43.  * @author Willie Walker
  44.  */
  45. public class MultiFileChooserUI extends FileChooserUI 
  46.     implements Serializable {
  47.  
  48.     /**
  49.      * The Vector containing the real UI's.  This is populated 
  50.      * in the call to createUI, and can be obtained by calling
  51.      * getUIs.  The first element is guaranteed to the real UI 
  52.      * obtained from the default look and feel.
  53.      */
  54.     protected Vector uis = new Vector();
  55.  
  56. ////////////////////
  57. // Common UI methods
  58. ////////////////////
  59.  
  60.     public static ComponentUI createUI(JComponent c) {
  61.         ComponentUI mui = new MultiFileChooserUI();
  62.         return MultiLookAndFeel.createUIs(mui,
  63.                                           ((MultiFileChooserUI) mui).uis,
  64.                                           c);
  65.     }
  66.  
  67.     /**
  68.      * Return the list of UI's associated with this multiplexing UI.  This 
  69.      * allows processing of the UI's by an application aware of multiplexing 
  70.      * UI's on components.
  71.      */
  72.     public ComponentUI[] getUIs() {
  73.         return MultiLookAndFeel.uisToArray(uis);
  74.     }
  75.  
  76. //////////////////////
  77. // ComponentUI methods
  78. //////////////////////
  79.  
  80.     public void installUI(JComponent c) {
  81.         for (int i = 0; i < uis.size(); i++) {
  82.             ((ComponentUI) (uis.elementAt(i))).installUI(c);
  83.         }
  84.     }
  85.  
  86.     public void uninstallUI(JComponent c) {
  87.         for (int i = 0; i < uis.size(); i++) {
  88.             ((ComponentUI) (uis.elementAt(i))).uninstallUI(c);
  89.         }
  90.     }
  91.   
  92.     public void paint(Graphics g, JComponent c) {
  93.         for (int i = 0; i < uis.size(); i++) {
  94.             ((ComponentUI) (uis.elementAt(i))).paint(g,c);
  95.         }
  96.     }
  97.       
  98.     public void update(Graphics g, JComponent c) {
  99.         for (int i = 0; i < uis.size(); i++) {
  100.             ((ComponentUI) (uis.elementAt(i))).update(g,c);
  101.         }
  102.     }
  103.  
  104.     public Dimension getPreferredSize(JComponent c) {
  105.         return ((ComponentUI) (uis.elementAt(0))).getPreferredSize(c);
  106.     }
  107.  
  108.     public Dimension getMinimumSize(JComponent c) {
  109.         return ((ComponentUI) (uis.elementAt(0))).getMinimumSize(c);
  110.     }
  111.  
  112.     public Dimension getMaximumSize(JComponent c) {
  113.         return ((ComponentUI) (uis.elementAt(0))).getMaximumSize(c);
  114.     }
  115.  
  116.     public boolean contains(JComponent c, int x, int y) {
  117.         return ((ComponentUI) (uis.elementAt(0))).contains(c,x,y);
  118.     }
  119.  
  120. ////////////////////////
  121. // FileChooserUI methods
  122. ////////////////////////
  123.  
  124.     public String getApproveButtonText() {
  125.         return ((FileChooserUI) (uis.elementAt(0))).getApproveButtonText();
  126.  
  127.     }
  128.  
  129.     public String getDialogTitle() {
  130.         return ((FileChooserUI) (uis.elementAt(0))).getDialogTitle();
  131.     }
  132.  
  133.     public FileFilter getAcceptAllFileFilter() {
  134.         return ((FileChooserUI) (uis.elementAt(0))).getAcceptAllFileFilter();
  135.     }
  136.  
  137.     public FileView getFileView() {
  138.         return ((FileChooserUI) (uis.elementAt(0))).getFileView();
  139.     }
  140.  
  141.     public void rescanCurrentDirectory() {
  142.         ((FileChooserUI) (uis.elementAt(0))).rescanCurrentDirectory();
  143.     }
  144.  
  145.     public void ensureFileIsVisible(File f) {
  146.         ((FileChooserUI) (uis.elementAt(0))).ensureFileIsVisible(f);
  147.     }
  148.  
  149. }
  150.